package shop.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import shop.mapper.SysSupplierMapper;
import shop.pojo.Supplier;
import shop.service.SysSupplierService;

import java.util.List;

@Service
public class SysSupplierServiceImpl implements SysSupplierService {

    @Autowired
    SysSupplierMapper sysSupplierMapper;






    @Override
    public Integer getSupplierCount(String queryRealName, String queryRoleId) {
        return sysSupplierMapper.getSupplierCount(queryRealName, queryRoleId);
    }

    @Override
    public List<Supplier> getSupplierList(String querySupCode, String querySupName, Integer pageIndex, int pageSize) {
        return sysSupplierMapper.getSupplierList(querySupCode, querySupName,pageIndex,pageSize);
    }

    @Override
    public Supplier getSupplierDetail(Integer supId) {
        return sysSupplierMapper.getSupplierDetail(supId);
    }

    @Override
    public int update(Supplier supplier) {
        return sysSupplierMapper.update(supplier);
    }

    @Override
    public boolean supplierExistsById(Integer supId) {
        if (sysSupplierMapper.supplierExistsById(supId)>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public Integer deleteSupplierById(Integer supId) {
        return sysSupplierMapper.deleteSupplierById(supId);
    }

    @Override
    public boolean add(Supplier supplier) {
        if(sysSupplierMapper.add(supplier)>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public List<Supplier> getSupnameAndId() {
        return sysSupplierMapper.getSupnameAndId();
    }
}
